/*
 * smart-pwm-ss805x.h
 *
 * The smart pwm driver for SS805X.
 *
 * Copyright (C) 2024 Sinh Micro, Inc.
 * Subject to the GNU Public License, version 2.
 *
 * Author: lixiang<lixiang@sinhmicro.com>
 * 
 * Encoding format: GB2312
 * Version: v1.2.2
 * Date: 2024-11-05
 */

#ifndef __HAL_SMART_PWM_SS805X_H__
#define __HAL_SMART_PWM_SS805X_H__

#include "hal-config.h"
#include "timer.h"
#include "ui_config.h"

/*
 * smart pwm micros list below, and x can be 0, 2.
 * SPWMX_TIMER_INIT
 * init the smartpwm timer lowlayer 
 * 
 * SPWMX_TIMER_START
 * start the smartpwm timer lowlayer
 */
#define SPWM0_TIMER_INIT()                      (t0_init())
#define SPWM2_TIMER_INIT()                      (t2_init())                    

#define SPWM0_TIMER_START()                     (T0_CNT_START())
#define SPWM2_TIMER_START()                     (T2_CNT_START())                  

#if (CONFIG_USING_SMPWM0 == 1)
    #if (CONFIG_USING_TIMER0 == 0)
        #error("smartpwm0 must enabled toghther with timer0!") 
    #endif
#endif

#if (CONFIG_USING_SMPWM2 == 1)
    /* smart pwm & timer Association check */
    #if (CONFIG_USING_TIMER2 == 0)
        #error("smartpwm2 must enabled toghther with timer2!") 
    #endif
#endif

#endif